package com.zjm.collections.map;
import java.util.HashMap;
public class HashMapUseCase {
    private static transient int hashSeed = 0;


    public static void test1() {
        HashMap<Integer, String> map = new HashMap();
        map.put(new Integer(1), "new Integer(1)");
        System.out.println(map.get(new Integer(1)));
        boolean currentAltHashing = hashSeed != 0;
        System.out.println(currentAltHashing);
        int[] ary = new int[10];
        System.out.println("length: " + ary.length);

        int i1 = 1;
        int i2 = 2;
        int i3 = 3;
        int i4 = 4;
        int i5 = 5;
        int i6 = 6;
        System.out.println(i1 % 16);
        System.out.println(i2 % 16);
        System.out.println(i3 % 16);
        System.out.println(i4 % 16);
        System.out.println(i5 % 16);
        System.out.println(i6 % 16);

        // 取余运算可以用 位运算代替  (a % b) <=> (a & (b - 1)) 前提是 b 必须是 2 的整数次幂

        System.out.println(i1 & (16 - 1));
        System.out.println(i2 & (16 - 1));
        System.out.println(i3 & (16 - 1));
        System.out.println(i4 & (16 - 1));
        System.out.println(i5 & (16 - 1));
        System.out.println(i6 & (16 - 1));

        map.put(0, null);
        map.put(1, null);
        map.put(2, null);
        map.put(3, null);
        map.put(4, null);
        map.put(5, null);
        map.put(6, null);
        map.put(7, null);
        map.put(8, null);
        map.put(9, null);
        map.put(10, null);
        map.put(11, null);
        map.put(12, null);
        map.put(13, null);
        map.put(14, null);
        map.put(15, null);
        map.put(16, null);
        map.put(17, null);
        map.put(18, null);
    }
    public static void main(String[] args) {
        test1();
    }

    public static void testResize() {
        HashMap<Integer, String> map = new HashMap<>();
        map.put(1, null);
        map.put(2, null);
        map.put(3, null);

    }
}
